//
//  XDHeader.h
//  XDCommonApp
//
//  Created by XD-XY on 2/12/14.
//  Copyright (c) 2014 XD-XY. All rights reserved.
//

#ifndef XDCommonApp_XDHeader_h
#define XDCommonApp_XDHeader_h



//===========================================控制参数=====================================================
/*引导页数量
  当引导页为0时，表示没有引导页
 */
#define GUIDECOUNT 2


/****
 tabbar是否是需要登录才能进入(0表示不需要，1表示需要)
 ****/
#define NEEDACCOUNTFORLOGIN @[@"0",@"1",@"0",@"0"]
//程序进去默认选择第几个tabar
#define DEFAULTSELECTINDEX 0

//statusBar 背景图片
#define STATUSBARBG @"statusBar_bg"
//显示隐藏statusBar
#define SETSTATUSBARHIDDEN(isHidden)\
if (isHidden){\
[[UIApplication sharedApplication] setStatusBarHidden:YES];\
}else{\
[[UIApplication sharedApplication] setStatusBarHidden:NO];\
}

/*设置statusBar的字体
 UIStatusBarStyleDefault:黑体白字
 UIStatusBarStyleLightContent:黑体黑字
 */
#define SETSTATUSBARTEXTBLACKCOLORE(isBlack)\
if (isBlack){\
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];\
}else{\
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];\
}

//颜色值
#define BGCOLOR [UIColor colorWithRed:255.0/255.0 green:254.0/255.0 blue:250.0/255.0 alpha:1];


//用户信息
#define kMY_USER_NAME               @"myUserName"
#define kMY_USER_ID                 @"myUserId"
#define kMY_USER_PASSWORD           @"myUserPassword"
#define kMY_USER_HEADERURL          @"userHeaderUrl"
#define kMY_USER_FACE               @"myUserFace"
#define kMY_USER_IPHONE             @"myIphone"

#define kMY_USER_TOKEN              @"myUserToken"
#define kMYCOOKIES                  @"myCookies"
#define kMMyUserInfo                @"myUserInfo"


#define kWBTOKEN                    @"wbtoken"
#define kWBINFO                     @"wbinfo"
#define kWBEXPIRETIME               @"wbexpiretime"
#define kWBUID                      @"wbuid"



//一级页面的导航栏标题
#define FIRSTVIEWTITLETEXT  @"首页"
#define SECONDVIEWTITLETEXT @"订单"
#define THIRDVIEWTITLETEXT  @"个人中心"
#define FOURTHVIEWTITLETEXT @"更多"
#define FIFTHVIEWTITLETEXT  @"FIVE"

/******
 导航栏
 ******/
#define NAVIGATIONBGIMAGEIOS7 @"nav_bg_ios7"
#define NAVIGATIONBGIMAGE @"nav_bg"
#define NAVIGATIONTITLEFONT [UIFont systemFontOfSize:17.0f]
#define NAVIGATIONTITLECOLORE  UIColorFromRGB(0x929292)


//=======================================友盟分享==================================================
#define UMAPPKEY @"5448cc3cfd98c57f49000673"
#define WEIXINAPPID @"wx948ce2e1125df48e"
#define WEIXINSECRET @"b38fbd19c7470bbf859701158b94d1f9"
#define SHARETITLE @"请输入您要分享的文字"
#define DOWNLOADRUL @"http://www.google.com.hk/"

#define QQAPPKEY @"kMUZpqgUTEEKAUgT"
#define QQAPPID  @"10021591"

//走马灯图片数量
#define PAGESCROLLVIEWNUMBER 4
//走马灯固定的图片(若无图片用 nil表示)
#define PAGESCROLLVIEWIMAGE1 @"tab_button1_notOn"
#define PAGESCROLLVIEWIMAGE2 @"tab_button2_notOn"
#define PAGESCROLLVIEWIMAGE3 @"tab_button3_notOn"
#define PAGESCROLLVIEWIMAGE4 @"tab_button4_notOn"
//走马灯的图片来源是否是网络请求来的(YES表示是，NO表示不是)
#define ISREQUSETIMAGE YES
//默认背景图片
#define PAGEDEFAULTIAMGE [UIImage imageNamed:@"normalPageScrollviewImage"]
//每张图片是否有点击事件(YES 表示有， NO 表示没有)
#define ISHAVEGESTURECLICK YES



//=======================================通用坐标=====================================================
#define UI_NAVIGATION_BAR_HEIGHT        44
#define UI_TOOL_BAR_HEIGHT              44
#define UI_TAB_BAR_HEIGHT               49
#define UI_STATUS_BAR_HEIGHT            20
#define UI_SCREEN_WIDTH                 ([[UIScreen mainScreen] bounds].size.width)
#define UI_SCREEN_HEIGHT                ([[UIScreen mainScreen] bounds].size.height)
#define UI_MAINSCREEN_HEIGHT            (UI_SCREEN_HEIGHT - UI_STATUS_BAR_HEIGHT)
#define UI_MAINSCREEN_HEIGHT_ROTATE     (UI_SCREEN_WIDTH - UI_STATUS_BAR_HEIGHT)
#define UI_WHOLE_SCREEN_FRAME           CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_SCREEN_HEIGHT)
#define UI_WHOLE_SCREEN_FRAME_ROTATE    CGRectMake(0, 0, UI_SCREEN_HEIGHT, UI_SCREEN_WIDTH)
#define UI_MAIN_VIEW_FRAME              CGRectMake(0, UI_STATUS_BAR_HEIGHT, UI_SCREEN_WIDTH, UI_MAINSCREEN_HEIGHT)
#define UI_MAIN_VIEW_FRAME_ROTATE       CGRectMake(0, UI_STATUS_BAR_HEIGHT, UI_SCREEN_HEIGHT, UI_MAINSCREEN_HEIGHT_ROTATE)
#define UI_NONAVBAR_VIEW_FRAME          CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_MAINSCREEN_HEIGHT - UI_NAVIGATION_BAR_HEIGHT)
#define UI_APPLICTION_VIEW_FRAME        CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_MAINSCREEN_HEIGHT)


#define     VIEW_POINT_MAX_Y(view)         CGRectGetMaxY(view.frame)+3
#define     VIEW_POINT_MAX_X(view)         CGRectGetMaxX(view.frame)+3
#define     VIEW_POINT_MIN_X(view)         CGRectGetMinX(view.frame)+3
#define     VIEW_POINT_MIN_Y(view)         CGRectGetMinY(view.frame)+3
#define     UILABEL_TAG                    1000
#define     UIBUTTON_TAG                   2000
#define     UIIMAGEVIEW_TAG                3000
#define     UIVIEW_TAG                     5000


//首次启动
#define ISFIRSTSTART  @"isfirststart"

//判断是否是ios7系统
#define IOS7                           [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.f
//判断是否是iphone5的设备
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

//算 宽加X坐标的和
#define width_x(view)  view.frame.size.width + view.frame.origin.x
//算 高加Y坐标的和
#define height_y(view)  view.frame.size.height + view.frame.origin.y

//判断是否登录
#define ISLOGING  [[[NSUserDefaults standardUserDefaults] objectForKey:kMY_USER_ID] length] > 0

//打印输出
#ifdef DEBUG

#define DDLOG(...) NSLog(__VA_ARGS__)
#define DDLOG_CURRENT_METHOD NSLog(@"%@-%@", NSStringFromClass([self class]), NSStringFromSelector(_cmd))

#else

#define DDLOG(...) ;
#define DDLOG_CURRENT_METHOD ;

#endif

/*********
 宏作用:单例生成宏
 使用方法:http://blog.csdn.net/totogo2010/article/details/8373642
 **********/
#define DEFINE_SINGLETON_FOR_HEADER(className) \
\
+ (className *)shared##className;

#define DEFINE_SINGLETON_FOR_CLASS(className) \
\
+ (className *)shared##className { \
static className *shared##className = nil; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
shared##className = [[self alloc] init]; \
}); \
return shared##className; \
}

//RGB color macro
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
//RGB color macro with alpha
#define UIColorFromRGBWithAlpha(rgbValue,a) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:a]
//RBG color
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]

//字符串不为空
#define IS_NOT_EMPTY(string) (string !=nil && [string isKindOfClass:[NSString class]] && ![string isEqualToString:@""])

//数组不为空
#define ARRAY_IS_NOT_EMPTY(array) (array && [array isKindOfClass:[NSArray class]] && [array count])

//读取图片两种方式
#define LOADIMAGE(file) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:file ofType:@"png"]]
#define IMAGE(name) [UIImage imageNamed:name]

#define CIMAGE(A) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:A ofType:nil]]

#define mClearColor [UIColor clearColor]

#define brokenNetwork                     @"网络未连接,请检查您的网络设置"
#define networkovertime                          @"网络请求超时"
//头像默认图
#define headDefaultImg                    LOADIMAGE(@"12311")
#define ivDetaultImg                      LOADIMAGE(@"12311")

#define BJcityID      @"x517FAF176C4E419FB6B14AB9C819A874x"

#pragma mark - Api macro
//////////////////////////////////接口定义

#define HOST_URL                            @"http://192.168.0.12/index.php?m=Api&c="      //内网测试地址
//#define HOST_URL                          @"http://www.meike365.cn/index.php?m=Api&c="    //正式地址
//#define HOST_URL                            @"http://api.meike365.cn/index.php?m=Api&c="

#define homepage_banner                   @"Index&a=banner"             //首页banner
#define scene_info                        @"Index&a=scene"              //获取场景信息
#define works_list                        @"Works&a=getWorksList"       //作品浏览
#define works_detail                      @"Works&a=getWorksDetail"     //作品详情
#define taocan_detail                     @"Works&a=getSeriesDetail"    //套餐详情
#define API_GetSeriesDetail               @"Works&a=newGetSeriesDetail" //获取摄影师ID

#define API_CAMRAMANLIST                      @"Works&a=getEmplList"  //摄影师列表
#define API_FREEPAILIST                       @"Works&a=getEmplByRange"   //随意拍列表
#define API_CHANGJINGINFO                     @"Index&a=scene"  //获取场景信息
#define API_CITYINFO                          @"Index&a=city"   //获取城市信息
#define API_CAMERAMANDETAIL                   @"Works&a=getEmplDetail" //摄影师详情
#define API_COLLECT                           @"Customer&a=addCollection" //收藏

#define API_cancellation                      @"Customer&a=cancellation"    //取消收藏
#define API_CHOOSEIMAGEROOT                 @"Customer&a=prodhasphoto" //选片外层页面
#define API_GETPHOTO                        @"Customer&a=getPhoto"     //获取相册图片
#define API_PUSHPHOTO                       @"Customer&a=customerXp" //提交选片数据
#define API_ADDRESS                         @"Customer&a=addCustomerAddr" //选片收货地址

#define API_getPhotoStudio                    @"Works&a=getPhotoStudio" //摄影影棚
#define API_getPhotoMode                      @"Works&a=getPhotoMode"   //获取拍摄方式
#define API_getEmplTime                       @"Works&a=getEmplTime"    //获取摄影师时间
#define API_checkOrder                        @"Order&a=checkOrder"     //检查订单合法性
#define API_addOrder                          @"Order&a=addOrder"       //提交订单
#define API_addFreeOrder                      @"Order&a=addCXOrder"     //提交随意拍订单
#define API_cancelOrder                       @"Order&a=cancelOrder"    //取消订单
#define api_addCXOrder                        @"Order&a=addCXOrder"     //添加出生照照片
#define API_CSPrice                           @"Index&a=CSPrice"        //出生照

// 获取顾客的常用地址
#define API_customer_address    @"Customer&a=getAddress"
// 添加常用地址
#define API_add_customer_address  @"Customer&a=addAddress"
// 设置默认地址
#define API_default_address    @"Customer&a=setDefault"
// 删除常用地址
#define API_delDefault_address    @"Customer&a=delAddress"


#define API_CUSTOMER_ORDER_LIST            @"Customer&a=getCustomerOrder"//客户订单列表
#define API_CUSTOMER_ORDER_DETAILL         @"Customer&a=getCustomerOrderDetail"//客户订单详情
#define API_SMSGET                         @"Index&a=sendsms"
#define API_REGISTER                       @"Index&a=register&Type=R"
#define API_LOGIN                          @"Index&a=login&UserType=G&UserAction=L"
//#define API_PWD_CHANGE                     @"Index&a=login&UserType=G&UserAction=P&Type=G"
#define API_LOGINOUT                       @"Index&a=loginout"
#define API_GETVERSION                     @"Index&a=version"
#define API_PERSONINFO                     @"Customer&a=personInfo"     //获取个人资料
#define API_UPDATEINFO                     @"Customer&a=updateCustomerInfo"  //编辑个人资料

//http://123.57.16.119/index.php?m=Api&c=Customer&a=updateCustomerInfo
#define API_SMSGET                         @"Index&a=sendsms"   //发短信
#define API_REGISTER                       @"Index&a=register&Type=R" //注册
#define API_LOGIN                          @"Index&a=login&UserType=G&UserAction=L"// 登录
#define API_PWD_CHANGE                     @"Index&a=login&UserType=G&UserAction=P"//修改密码
#define API_PWD_foget                     @"Index&a=login&UserType=G&UserAction=W"//修改密码
#define API_LOGINOUT                       @"Index&a=loginout" //退出登录
#define API_GETVERSION                     @"Index&a=version"//检查版本
#define API_PUBLISHCOMMENT                 @"Customer&a=addReview"      //发布评论


//#define API_GETCOMMENTS                    @"Photographer&a=review"    //获取评论列表
#define API_CAMERAMAN_HOME_INFO            @"Photographer&a=empl"     //摄影师主页
#define API_USER_COLLECT                   @"Customer&a=collection"  //用户收藏

#define API_CHANGEYOUHUIQUAN               @"Customer&a=getRedBags"    //兑换优惠券
#define API_GETYOUHUIQUAN                  @"Customer&a=getVoucher"    //获取优惠券列表
#define API_CHOOSEIMAGEOK                  @"Customer&a=finishXP"      //选片完成

#define API_GETCOMMENTS                    @"Works&a=getComment"    //获取评论列表
#define API_CAMERAMAN_HOME_INFO            @"Photographer&a=empl"  //摄影师主页
#define API_getReview                      @"Customer&a=getReview"   //获取默认的评论

#define API_ORDERRECORDER                  @"Order&a=orderLog"     //订单记录
#define API_CONFIRMORDER_RECEIVED          @"Order&a=confirmSH"  //确认收货
#define API_CHECKORDERTIME                 @"Order&a=checkOrderTime" //确认订单时间
#define API_CHECKORDER                     @"Order&a=checkOrder"     //检验订单合法性
#define API_GETADDRESS                     @"Customer&a=customerAddr" //获取收货地址
#define API_getEmplByRange                 @"Works&a=getEmplByRange"  //随e拍获取附件的摄影师

#define API_getDetail                      @"Works&a=detail"        //获取综合详情


#pragma mark  /////////////公共颜色的值

#define  CONTENTVIEW_COLOR                0xfffefa

//拨打电话
#define canTel            ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel:"]])
#define tel(phoneNumber)  ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneNumber]]])
#define telprompt(phoneNumber) ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"telprompt:%@",phoneNumber]]])


/**
 选择场景时，type字段  
 1表示医院  
 2表示上门  
 3表示影棚  
 4表示医院和上门  
 5表示上门和影棚
 */

#endif
